home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 59 / 59.xpi / chrome / useragentswitcher.jar / content / useragentswitcher / about / about.js < prev    next >
Text File  |  2009-06-30  |  716b  |  32 lines

  1. // User Agent Switcher about
  2. var UserAgentSwitcherAbout = 
  3. {
  4.     // Opens the URL in a new tab
  5.     openURL: function(urlElement)
  6.     {
  7.         var parentWindow = null;
  8.         var url          = urlElement.firstChild.nodeValue;
  9.     
  10.         // If there is a parent window
  11.         if(window.opener)
  12.         {
  13.             // If there is a grand parent window and it has the extension menu
  14.             if(window.opener.opener && window.opener.opener.document.getElementById("useragentswitcher-menu"))
  15.             {
  16.                 parentWindow = window.opener.opener;
  17.             }
  18.             else
  19.             {
  20.                 parentWindow = window.opener;
  21.             }
  22.         }
  23.     
  24.         // If a parent window was found
  25.         if(parentWindow)
  26.         {
  27.             parentWindow.getBrowser().selectedTab = parentWindow.getBrowser().addTab(url);
  28.     
  29.             window.close();
  30.         }
  31.     }
  32. };